package component.fy.com.common_module.retrofit;

import java.util.List;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Url;

/**
 * Created by Administrator on 2017/10/17 0017.
 */

public interface RetrofitService {
    //check_update.php
    @GET()
    Call<ResponseBody> doGet(@Url String url);

    @GET()
    Call<ResponseBody> doGet(@Header("Authorization") String header, @Url String url);

    // @GET注解的作用:采用Get方法发送网络请求
    // getCall() = 接收网络请求数据的方法
    // 其中返回类型为Call<*>，*是接收数据的类（即上面定义的Translation类） ;
    @Headers("Content-Type: application/json")
    @POST()
    Call<ResponseBody> doPost(@Url String url, @Body RequestBody requestBody);

    @Headers("Content-Type: application/json")
    @POST()
    Call<ResponseBody> doPost(@Header("Authorization") String header, @Url String url, @Body RequestBody requestBody);

    @Multipart
    @POST()
    Call<ResponseBody> uploadImgs(@Header("Authorization") String header, @Url String url, @Part List<MultipartBody.Part> files);
}
